package com.yuntuzhilian.chapter2;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;

/**
 * @author MrWang-shuizhishuiheshui
 * @description
 */
public class Demo8 {
    public static void main(String[] args) {
//        for (int i = 0; i < 100; i++) {
//            double v = Math.random();
//            System.out.println(v);
//        }

        // Math.random() : 随机生成 0.0<=  <1.0之间的小数
        /*
        Math.random()*10 :              0.0<=    <10.0
        Math.random()*10 + 100  :       100.0<=  <110.0
        (int)(Math.random()*10)+100 :   100<=    <=109

        1000~9999
        1000<=  <10000     -1000
        0<=  <9000   /9000
        0<=  <1
        (int)(Math.random()* 9000 ) + 1000 :

        888~999
        (int)(Math.random()* 112 ) + 888 :

        77~99
        (int)(Math.random()* 23 ) + 77 :
         */

//        System.out.println(Math.abs(-10.0));
//        System.out.println(Math.max(10,15));
//        System.out.println(Math.min(10,15));

        /*用于处理随机列*/
//        Random rand=new Random();
//        for (int i = 0; i <1000 ; i++) {
//            System.out.println(rand.nextInt(100));
//        }

        //获取当前系统的日期对象
//        Date date=new Date();
//        //创建用于日期格式化的对象  ()参数为日期展示的匹配形式
//        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss E");
//        //用格式化对象对date进行格式化输出,返回String类型的值
//        String format = sdf.format(date);
//        System.out.println(format);

        Calendar cal=Calendar.getInstance();
        System.out.println(cal.get(Calendar.YEAR));
        System.out.println(cal.get(Calendar.MONTH));
        System.out.println(cal.get(Calendar.DAY_OF_WEEK));
        System.out.println(cal.get(Calendar.DAY_OF_MONTH));



        System.out.println(Calendar.YEAR);
        System.out.println(Calendar.MONTH);
        System.out.println(Calendar.DAY_OF_WEEK);
        System.out.println(Calendar.DAY_OF_MONTH);
    }
}
